<?php
// +----------------------------------------------------------------------
// | 07FLYSAAS [基于ThinkPHP5.0开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2025-2035 http://www.07fly.xyz
// +----------------------------------------------------------------------
// | Professional because of focus  Persevering because of happiness
// +----------------------------------------------------------------------
// | Author: 开发人生 <goodkfrs@qq.com>
// +----------------------------------------------------------------------


namespace app\plat\logic;

/**
 * 授权逻辑
 */
class TenRoleMenu extends PlatBase
{
    /**
     * 获得权限菜单列表
     */
    public function getRoleMenuList($tenUserId = 0, $tenTenantId = '0')
    {
        // 租户管理员,获得租户管理员权限
        if (IS_TENANT_ROOT) {
            return $this->modelTenRoleMenu->getTenTenantMenu($tenTenantId);
        }
        // 当为普通用户，获得用户权限
        $user_menu_list = $this->modelTenRoleMenu->getTenUserMenu($tenUserId);

        return $user_menu_list;
    }

    /**
     * 获得权限菜单URL列表
     */
    public function getAuthMenuUrlList($auth_menu_list = [])
    {
        $auth_list = [];
        foreach ($auth_menu_list as $info) {
            $auth_list[] = $info['url'];
        }
        return $auth_list;
    }
}
